<include file="public@header" />
<link rel="stylesheet" href="/themes/admin_simpleboot3/admin/freight/css/fright.css">
<script src="/themes/admin_simpleboot3/admin/freight/js/jquery.selectric.js"></script>
<script src="/themes/admin_simpleboot3/admin/freight/js/freight_edit.js"></script>
<link rel="stylesheet" href="/themes/admin_simpleboot3/admin/freight/css/selectric.css">
<div class="ns-main">
    <div class="options-btn">
        <button class="btn-common" onclick="location.href='{:url(\'admin/freight/index_freight\',array(\'type\'=>1,\'id\'=>$param[\'tpl_id\']))}';" style="background: #ccc">返回</button>

        <button class="btn-common" onclick="location.href=' {:url(\'admin/freight/add_freight\',array(\'type\'=>1,\'tpl_id\'=>$param[\'tpl_id\']))}';"  <eq name="param['type']" value="1"> style="background: red" </eq>>配置默认地区</button>

        <button class="btn-common" onclick="location.href=' {:url(\'admin/freight/add_freight\',array(\'type\'=>2,\'tpl_id\'=>$param[\'tpl_id\']))}';"  >添加指定地区</button>
        <eq name="param['type']" value="2"> <button class="btn-common"<eq name="param['type']" value="2"> style="background: red" </eq> >编辑指定地区</button></eq>
    </div>
    <div class="space-10"></div>
    <div class="freight-template">
        <div class="table-div">
            <table>
                <tbody>
                <tr>
                    <td colspan="2" class="bg-f5f5f5">
                        <div class="table-title-font">
                            <span>运费信息</span>
                        </div> </td>
                </tr>
                <tr>
                    <td class="table-first-td"> <label for="shipping_fee_name"><span class="star">*</span>模板名称</label> </td>
                    <td> <input id="shipping_fee_name" type="text" class="input-common" value="{$info.shipping_fee_name}"/> </td>
                </tr>
                <tr style="display: none">
                    <td class="table-first-td"> <label>模板地区类型</label> </td>
                    <td>
                        <select id="is_default" class="select-common" disabled>
                            <option value="1" <eq name="info['is_whole']" value="0">selected</eq>>默认地区</option>
                            <option value="0" <eq name="info['is_whole']" value="1">selected</eq>>指定地区</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="table-first-td"> <label><span class="star">*</span>选择地区</label> </td>
                    <td>
                        <eq name="info['is_whole']" value="0">
                        <!-- 添加 --> <span class="js-region-info region-info"></span> <a class="btn-gradient-default js-select-city" data-flag="1" href="javascript:;">默认地区(全国)</a>
                        </eq>
                        <eq name="info['is_whole']" value="1">
                                <!-- 添加 --> <span class="js-region-info region-info"></span> <a class="js-select-city btn-gradient-blue" data-flag="0" href="javascript:;">指定地区城市</a>
                        </eq>
                    </td>
                </tr>
                <tr>
                    <td class="table-first-td"> <label>按件数</label> </td>
                    <td>
                        <table class="input-info-table">
                            <tbody>
                            <tr>
                                <td width="20%" align="center">首件(件)</td>
                                <td width="20%" align="center">首件运费(元)</td>
                                <td width="20%" align="center">续件(件)</td>
                                <td width="20%" align="center">续件运费(元)</td>
                            </tr>
                            <tr>
                                <td align="center"> <input type="text" placeholder="0" id="bynum_snum" class="input-common harf" data-msg="首件不能是负数、并且必须是整数" data-rule="int" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" value="{$info.bynum_snum}"/> </td>
                                <td align="center"> <input type="text" placeholder="0" id="bynum_sprice" class="input-common harf" data-msg="首件运费不能为负数，并且保留两位小数" data-rule="double" value="{$info.bynum_sprice}"/> </td>
                                <td align="center"> <input type="text" placeholder="0" id="bynum_xnum" class="input-common harf" data-msg="续件不能是负数、并且必须是整数" data-rule="greater_int" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"  value="{$info.bynum_xnum}"/> </td>
                                <td align="center"> <input type="text" placeholder="0" id="bynum_xprice" data-msg="续件运费不能为负数，并且保留两位小数" class="input-common harf" data-rule="double" value="{$info.bynum_xprice}"/> </td>

                            </tr>
                            </tbody>
                        </table> </td>
                </tr>
                <tr>
                    <td class="table-first-td"> <label>按重量</label> </td>
                    <td>
                        <table class="input-info-table">
                            <tbody>
                            <tr>
                                <td width="20%" align="center">首重(kg)</td>
                                <td width="20%" align="center">首重运费(元)</td>
                                <td width="20%" align="center">续重(kg)</td>
                                <td width="20%" align="center">续重运费(元)</td>
                            </tr>
                            <tr>
                                <td align="center"> <input type="text" placeholder="0" id="weight_snum" value="{$info.weight_snum}" class="input-common harf" data-msg="首重不能为负数，并且保留两位小数" /> </td>
                                <td align="center"> <input type="text" placeholder="0" id="weight_sprice" value="{$info.weight_sprice}" class="input-common harf" data-msg="首重运费不能为负数，并且保留两位小数" data-rule="double" /> </td>
                                <td align="center"> <input type="text" placeholder="0" id="weight_xnum" value="{$info.weight_xnum}" data-msg="续重必须大于0，并且保留两位小数" class="input-common harf" data-rule="double" /> </td>
                                <td align="center"> <input type="text" placeholder="0" id="weight_xprice" value="{$info.weight_xprice}" data-msg="续重运费必须大于0，并且保留两位小数" class="input-common harf" data-rule="double" /> </td>

                            </tr>
                            </tbody>
                        </table> </td>
                </tr>
                <tr>
                    <td class="table-first-td"> <label>按体积</label> </td>
                    <td>
                        <table class="input-info-table">
                            <tbody>
                            <tr>
                                <td width="20%" align="center">首体积量(m&sup3;)</td>
                                <td width="20%" align="center">首体积运费(元)</td>
                                <td width="20%" align="center">续体积量(m&sup3;)</td>
                                <td width="20%" align="center">续体积运费(元)</td>
                            </tr>
                            <tr>
                                <td align="center"> <input type="text" placeholder="0" id="volume_snum"  value="{$info.volume_snum}" class="input-common harf" data-msg="首体积量不能为负数，并且保留两位小数" data-rule="double" /> </td>
                                <td align="center"> <input type="text" placeholder="0" id="volume_sprice" value="{$info.volume_sprice}" class="input-common harf" data-msg="首体积运费不能为负数，并且保留两位小数" data-rule="double" /> </td>
                                <td align="center"> <input type="text" placeholder="0" id="volume_xnum" value="{$info.volume_xnum}" class="input-common harf" data-msg="续体积量不能为负数，并且保留两位小数" data-rule="double" /> </td>
                                <td align="center"> <input type="text" placeholder="0" id="volume_xprice" value="{$info.volume_xprice}" class="input-common harf" data-msg="续体积运费不能为负数，并且保留两位小数" data-rule="double" /> </td>

                            </tr>
                            </tbody>
                        </table> </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="freight-template-footer">
            <button type="button" class="btn-common btn-big btn-save">保存</button>
            <button class="btn-common-cancle btn-big" onclick="window.location.href = window.history.go(-1);">返回</button>
            <input type="hidden" id="hidden_shipping_fee_id" value="{$info.shipping_fee_id}">
            <input type="hidden" id="hidden_province_id_array" value="{$info.province_id_array}"/>
            <input type="hidden" id="hidden_city_id_array" value="{$info.city_id_array}"/>
            <input type="hidden" id="hidden_district_id_array" value="{$info.district_id_array}"/>
            <input type="hidden" id="tpl_id" value="{$param['tpl_id']}" />
        </div>
    </div>
    <div class="mask-layer"></div>
    <div id="select-region" style="left: 50%; margin-left: -346px; top: 211px;" class="modal hide1 ui-draggable ui-draggable-handle in" tabindex="-1" role="dialog">
        <div class="title">
            <h2>选择地区</h2>
            <span class="cancle js-cancle">[取消]</span>
            <span class="confirm js-confirm">[确定]</span>
        </div>
        <div class="cont">
            <div class="selectSub dialog-areas">
                <ul class="js-regions">
                    <foreach name="$address_list" item="area" key="k">
                    <if condition="$area.province_list_count">
                    <li>
                        <div class="dcity clearfix">
                            <!-- 大类 -->
                            <div class="ecity gcity">
							<span class="group-label">
								<input id="first_region_{$k}" data-first-index="{$k}" value="<foreach name='area.province_list' item='province'>{$province.province_id},</foreach>" type="checkbox" />
								<label for="first_region_{$k}" title="{$area.area_name}">{$area.area_name}</label>
							</span>
                            </div>

                            <!-- 省 -->
                            <div class="province-list">

                                <foreach name="area.province_list" item="province" key="second">
                                <div class="ecity">
								<span class="gareas">
									<if condition="$province.is_disabled">
									<input disabled="disabled" data-is-disabled="1" data-second-parent-index="{$k}" data-province-id="{$province.province_id}" id="second_region_{$k}_{$province.province_id}" type="checkbox" data-province-name="{$province.province_name}" value="{$province.province_id}" />
									<label class="disabled" for="second_region_{$k}_{$province.province_id}" title="{$province.province_name}">{$province.province_name}</label>
									<else/>
									<input data-second-parent-index="{$k}" data-province-id="{$province.province_id}" id="second_region_{$k}_{$province.province_id}" type="checkbox" data-province-name="{$province.province_name}" value="{$province.province_id}" />
									<label for="second_region_{$k}_{$province.province_id}" title="{$province.province_name}">{$province.province_name}</label>
									</if>
									<img class="drop-down" src="/themes/admin_simpleboot3/admin/freight/images/freight_city_drop_down.gif" data-level="province" />

                                    <!-- 市 -->
									<div class="citys" id="citys_{$province.province_id}">
										<foreach name="province.city_list" item="city" key="third">
											<span class="areas">
												<if condition="$city.is_disabled">
												<input disabled="disabled" data-is-disabled="1" data-third-parent-index="{$k}" data-province-id="{$province.province_id}" data-city-id="{$city.city_id}" value="{$city.city_id}" id="third_{$k}_{$city.city_id}" type="checkbox" />
												<label class="disabled" for="third_{$k}_{$city.city_id}" title="{$city.city_name}">{$city.city_name}</label>
												<else/>
												<input data-third-parent-index="{$k}" data-province-id="{$province.province_id}" data-city-id="{$city.city_id}" value="{$city.city_id}" id="third_{$k}_{$city.city_id}" type="checkbox" />
												<label for="third_{$k}_{$city.city_id}" title="{$city.city_name}">{$city.city_name}</label>
												</if>
												<if condition="$city.district_list_count">
													<img class="drop-down" src="/themes/admin_simpleboot3/admin/freight/images/freight_city_drop_down.gif" data-level="city" />
												</if>

												<if condition="$city.district_list_count">
													<div class="district" id="district_{$city.city_id}">
													<foreach name="city.district_list" item="district" key="four">
													<span class="areas">
														<if condition="$district.is_disabled">
														<input disabled="disabled" data-is-disabled="1" data-four-parent-index="{$k}" data-city-id="{$city.city_id}" data-province-id="{$province.province_id}" value="{$district.district_id}" id="four_{$k}_{$district.district_id}" type="checkbox" />
														<label class="disabled" for="four_{$k}_{$district.district_id}" title="{$district.district_name}">{$district.district_name}{$district.is_disabled}</label>
														<else/>
														<input data-four-parent-index="{$k}" data-province-id="{$province.province_id}" data-city-id="{$city.city_id}" value="{$district.district_id}" id="four_{$k}_{$district.district_id}" type="checkbox" />
														<label for="four_{$k}_{$district.district_id}" title="{$district.district_name}">{$district.district_name}{$district.is_disabled}</label>
                                                        </if>
													</span>

                    </foreach>
													</div>
                                                </if>
											</span>
                    </foreach>
									</div>
								</span>
                                </div>
                    </foreach>

                            </div>
                        </div>
                    </li>
                    </if>
        </foreach>
                </ul>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $('.select-common').selectric();
        $(window).on("click",'.checkbox-common',function(){
            var checkbox = $(this).children("input");
            if(checkbox.is(":checked")) $(this).addClass("selected");
            else $(this).removeClass("selected");
        });

    })
</script>
<!-- 公共的操作提示弹出框 common-success：成功，common-warning：警告，common-error：错误，-->
<div class="common-tip-message js-common-tip">
    <div class="tip-container">
        <span class="inner"></span>
    </div>
</div>
</body>
</html>